<!--
  #%L
  Fork of JAI Image I/O Tools.
  %%
  Copyright (C) 2008 - 2015 Open Microscopy Environment:
    - Board of Regents of the University of Wisconsin-Madison
    - Glencoe Software, Inc.
    - University of Dundee
  %%
  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:
  
  1. Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice,
     this list of conditions and the following disclaimer in the documentation
     and/or other materials provided with the distribution.
  
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  POSSIBILITY OF SUCH DAMAGE.
  #L%
  -->

<!--
$RCSfile: package.html,v $


Copyright (c) 2005 Sun Microsystems, Inc. All  Rights Reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met: 

- Redistribution of source code must retain the above copyright 
  notice, this  list of conditions and the following disclaimer.

- Redistribution in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in 
  the documentation and/or other materials provided with the
  distribution.

Neither the name of Sun Microsystems, Inc. or the names of 
contributors may be used to endorse or promote products derived 
from this software without specific prior written permission.

This software is provided "AS IS," without a warranty of any 
kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND 
WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL 
NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF 
USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR 
ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,
CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND
REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR
INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. 

You acknowledge that this software is not designed or intended for 
use in the design, construction, operation or maintenance of any 
nuclear facility. 

$Revision: 1.1 $
$Date: 2005/02/11 05:01:16 $
$State: Exp $
-->
<body>
Package containing the public classes used by the Sun JPEG 2000 plug-in for
the Image I/O Framework.

<h3><a name="ImageMetadata"/>Image Metadata</h3>

<h4>Document Type Definition</h4>

The DTD for the native image metadata format is as follows:

<p>
<pre>
&lt;!DOCTYPE "com_sun_media_imageio_plugins_jpeg2000_image_1.0" [ 

  &lt;!ELEMENT com_sun_media_imageio_plugins_jpeg2000_image_1.0 (JPEG2000SignatureBox,
                                              JPEG2000FileTypeBox,
                                              OtherBoxes) &gt;

  &lt;!-- JPEG2000HeaderSuperBox should be before JPEG2000CodeStreamBox;  This
      is the only constraint for the sequence of these boxes --&gt;
  &lt;!ELEMENT OtherBoxes (JPEG2000HeaderSuperBox,
                          JPEG2000CodeStreamBox,
                          JPEG2000IntellectualPropertyRightsBox*,
                          JPEG2000XMLBox*,
                          JPEG2000UUIDBox*,
                          JPEG2000UUIDInfoBox*)&gt;

  &lt;!-- JPEG 2000 Signature box --&gt;
  &lt;!ELEMENT JPEG2000SignatureBox EMPTY&gt;
    &lt;!ATTLIST JPEG2000SignatureBox
              Length CDATA #FIXED "12"
              Type CDATA #FIXED "jP  "
              Signature CDATA #FIXED "0x0D0A870A"&gt;

  &lt;!-- JPEG 2000 File type box --&gt;
  &lt;!ELEMENT JPEG2000FileTypeBox (Brand, MinorVersion, CompatibilityList) &gt;
    &lt;!ELEMENT Brand (#PCDATA)&gt;
    &lt;!ELEMENT MinorVersion (#PCDATA)&gt;
    &lt;!ELEMENT CompatibilityList (#PCDATA)&gt;
    &lt;!ATTLIST JPEG2000FileTypeBox
              Length CDATA #FIXED "12"
              Type CDATA #FIXED "jP  "
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 header super box--&gt;
  &lt;!ELEMENT JPEG2000HeaderSuperBox (JPEG2000HeaderBox, OptionalBoxes) &gt;
    &lt;!ELEMENT OptionalBoxes (JPEG2000BitsPerComponentBox,
                                JPEG2000ColorSpecificationBox,
                                JPEG2000PaletteBox?,
                                JPEG2000ComponentMappingBox?,
                                JPEG2000ChannelDefinitionBox?,
                                JPEG2000ResolutionBox?)&gt;
    &lt;!ATTLIST JPEG2000HeaderSuperBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "jp2h"
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 image header box --&gt;
  &lt;!ELEMENT JPEG2000HeaderBox (Width, Height, NumComponents, BitDepth,
                                 CompressionType, UnknownColorspace,
                                 IntellectualProperty)&gt;
    &lt;!ELEMENT Width (#PCDATA)&gt;
    &lt;!ELEMENT Height (#PCDATA)&gt;
    &lt;!ELEMENT NumComponents (#PCDATA)&gt;
    &lt;!ELEMENT BitDepth (#PCDATA)&gt;
    &lt;!ELEMENT CompressionType (#PCDATA)&gt;
    &lt;!ELEMENT UnknownColorspace (#PCDATA)&gt;
    &lt;!ELEMENT IntellectualProperty (#PCDATA)&gt;
    &lt;!ATTLIST JPEG2000HeaderBox
              Length CDATA #FIXED "22"
              Type CDATA #FIXED "ihdr"&gt;

  &lt;!-- JPEG 2000 bits per component box --&gt;
  &lt;!ELEMENT JPEG2000BitsPerComponentBox (BitDepth)&gt;
    &lt;!ATTLIST JPEG2000BitsPerComponentBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "bpcc"
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 color specification box --&gt;
  &lt;!ELEMENT JPEG2000ColorSpecificationBox (Method, Precedence,
                                             ApproximationAccuracy,
                                             EnumeratedColorSpace,
                                             ICCProfile)&gt;
    &lt;!ELEMENT Method (#PCDATA)&gt;
    &lt;!ELEMENT Precedence (#PCDATA)&gt;
    &lt;!ELEMENT ApproximationAccuracy (#PCDATA)&gt;
    &lt;!ELEMENT EnumeratedColorSpace (#PCDATA)&gt;
    &lt;!ELEMENT ICCProfile (#PCDATA)&gt;
    &lt;!ATTLIST JPEG2000ColorSpecificationBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "colr"
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 palette box --&gt;
  &lt;!ELEMENT JPEG2000PaletteBox (NumberEntries, NumberColors,
                                  BitDepth,
                                  LUT)&gt;
    &lt;!ELEMENT NumberEntries (#PCDATA)&gt;
    &lt;!ELEMENT NumberColors (#PCDATA)&gt;
    &lt;!ELEMENT LUT (LUTRow*)&gt;
    &lt;!ELEMENT LUTRow (#PCDATA)&gt;
    &lt;!ATTLIST JPEG2000PaletteBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "pclr"
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 component mapping box--&gt;
  &lt;!ELEMENT JPEG2000ComponentMappingBox (Component, ComponentType,
                                           ComponentAssociation)&gt;
    &lt;!ELEMENT Component (#PCDATA)&gt;
    &lt;!ELEMENT ComponentType (#PCDATA)&gt;
    &lt;!ELEMENT ComponentAssociation (#PCDATA)&gt;
    &lt;!ATTLIST JPEG2000ComponentMappingBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "cmap"
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 channel definition box--&gt;
  &lt;!ELEMENT JPEG2000ChannelDefinitionBox (NumberOfDefinition, Definitions)&gt;
    &lt;!ELEMENT NumberOfDefinition (#PCDATA)&gt;
    &lt;!ELEMENT Definitions (ChannelNumber, ChannelType)*&gt;
    &lt;!ELEMENT ChannelNumber (#PCDATA)&gt;
    &lt;!ELEMENT ChannelType (#PCDATA)&gt;
    &lt;!ELEMENT ChannelAssociation (#PCDATA)&gt;
    &lt;!ATTLIST JPEG2000ChannelDefinitionBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "cdef"
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 resolution box--&gt;
  &lt;!ELEMENT JPEG2000ResolutionBox (JPEG2000CaptureResolutionBox,
                                     JPEG2000DefaultDisplayResolutionBox)&gt;
    &lt;!ATTLIST JPEG2000ResolutionBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "res "
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 capture resolution box--&gt;
  &lt;!ELEMENT JPEG2000CaptureResolutionBox (VerticalResolutionNumerator,
                                            VerticalResolutionDenominator,
                                            HorizontalResolutionNumerator,
                                            HorizontalResolutionDenominator,
                                            VerticalResolutionExponent,
                                            HorizontalResolutionExponent)&gt;
    &lt;!ELEMENT VerticalResolutionNumerator (#PCDATA)&gt;
    &lt;!ELEMENT VerticalResolutionDenominator (#PCDATA)&gt;
    &lt;!ELEMENT HorizontalResolutionNumerator (#PCDATA)&gt;
    &lt;!ELEMENT HorizontalResolutionDenominator (#PCDATA)&gt;
    &lt;!ELEMENT VerticalResolutionExponent (#PCDATA)&gt;
    &lt;!ELEMENT HorizontalResolutionExponent (#PCDATA)&gt;
    &lt;!ATTLIST JPEG2000CaptureResolutionBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "resc"
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 default display resolution box--&gt;
  &lt;!ELEMENT JPEG2000DefaultDisplayResolutionBox (VerticalResolutionNumerator,
                                            VerticalResolutionDenominator,
                                            HorizontalResolutionNumerator,
                                            HorizontalResolutionDenominator,
                                            VerticalResolutionExponent,
                                            HorizontalResolutionExponent)&gt;
    &lt;!ATTLIST JPEG2000DefaultDisplayResolutionBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "resd"
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 code stream box--&gt;
  &lt;!ELEMENT JPEG2000CodeStreamBox (CodeStream)&gt;
    &lt;!ELEMENT CodeStream (#PCDATA)&gt;
    &lt;!ATTLIST JPEG2000CodeStreamBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "jp2c"
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 intellectual property rights box--&gt;
  &lt;!ELEMENT JPEG2000IntellectualPropertyRightsBox (Content)&gt;
    &lt;!ELEMENT Content (#PCDATA)&gt;
    &lt;!ATTLIST JPEG2000IntellectualPropertyRightsBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "jp2i"
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 XML box--&gt;
  &lt;!ELEMENT JPEG2000XMLBox (Content)&gt;
    &lt;!ATTLIST JPEG2000XMLBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "xml "
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 UUID box--&gt;
  &lt;!ELEMENT JPEG2000UUIDBox (UUID, Data)&gt;
    &lt;!ELEMENT UUID (#PCDATA)&gt;
    &lt;!ELEMENT Data (#PCDATA)&gt;
    &lt;!ATTLIST JPEG2000UUIDBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "uuid"
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 UUID info box--&gt;
  &lt;!ELEMENT JPEG2000UUIDInfoBox (JPEG2000UUIDListBox, JPEG2000DataEntryURLBox)&gt;
    &lt;!ATTLIST JPEG2000UUIDInfoBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "uinf"
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 UUID list box--&gt;
  &lt;!ELEMENT JPEG2000UUIDListBox (NumberUUID, UUID*)&gt;
    &lt;!ELEMENT NumberUUID (#PCDATA)&gt;
    &lt;!ATTLIST JPEG2000UUIDListBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "ulst"
              ExtraLength CDATA #IMPLIED&gt;

  &lt;!-- JPEG 2000 Data Entry URL box--&gt;
  &lt;!ELEMENT JPEG2000DataEntryURLBox (Version, Flags, Location)&gt;
    &lt;!ELEMENT Version (#PCDATA)&gt;
    &lt;!ELEMENT Flags (#PCDATA)&gt;
    &lt;!ELEMENT URL (#PCDATA)&gt;
    &lt;!ATTLIST JPEG2000DataEntryURLBox
              Length CDATA #REQUIRED
              Type CDATA #FIXED "url "
              ExtraLength CDATA #IMPLIED&gt; ]
</pre>
</p>

<h4>XML Schema</h4>

The XML schema for the native image metadata format is as follows:

<pre>

&lt;?xml version="1.0" ?&gt;
&lt;!--Schema for JPEG 2000 image format --&gt;

&lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	    xmlns="http://com.sun.media.imageio"
	    targetNamespace="http://com.sun.media.imageio"&gt;

  &lt;!-- JPEG 2000 Image File--&gt;
  &lt;xsd:element name="com_sun_media_imageio_plugins_jpeg2000_image_1.0"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element ref="JPEG2000SignatureBox" /&gt;
        &lt;xsd:element ref="JPEG2000FileTypeBox" /&gt;
        &lt;!-- JPEG2000HeaderSuperBox should be before JPEG2000CodeStreamBox;
          This is the only constraint for the sequence of these boxes --&gt;
        &lt;xsd:element name="OtherBoxes"&gt;
        &lt;xsd:complexType&gt;
          &lt;xsd:all&gt;
            &lt;xsd:element ref="JPEG2000HeaderSuperBox" /&gt;
            &lt;xsd:element ref="JPEG2000CodeStreamBox" /&gt;

            &lt;xsd:element ref="JPEG2000IntellectualPropertyRightsBox" minOccurs="0" maxOccurs="unbounded" /&gt;
            &lt;xsd:element ref="JPEG2000XMLBox" minOccurs="0" maxOccurs="unbounded" /&gt;
            &lt;xsd:element ref="JPEG2000UUIDBox" minOccurs="0" maxOccurs="unbounded" /&gt;
            &lt;xsd:element ref="JPEG2000UUIDInfoBox" minOccurs="0" maxOccurs="unbounded" /&gt;
          &lt;/xsd:all&gt;
        &lt;/xsd:complexType&gt;
        &lt;/xsd:element&gt;
      &lt;/xsd:sequence&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 Signature box --&gt;
  &lt;xsd:element name="JPEG2000SignatureBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" fixed="12" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="jP  " /&gt;
      &lt;xsd:attribute name="Signature" type="xsd:hexBinary" use="required" fixed="0D0A870A" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 File type box --&gt;
  &lt;xsd:element name="JPEG2000FileTypeBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element name="Brand" type = "xsd:unsignedInt" /&gt;

        &lt;xsd:element name="MinorVersion" minOccurs="0"&gt;
          &lt;xsd:simpleType&gt;
            &lt;xsd:restriction base="xsd:unsignedInt"&gt;
              &lt;xsd:enumeration value="0" /&gt;
            &lt;/xsd:restriction&gt;
          &lt;/xsd:simpleType&gt;
        &lt;/xsd:element&gt;

        &lt;xsd:element name="CompatibilityList" type="IntegerList" /&gt;
      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="ftyp" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 header super box--&gt;
  &lt;xsd:element name="JPEG2000HeaderSuperBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element ref="JPEG2000HeaderBox" /&gt;
        &lt;xsd:element name="OptionalBoxes" minOccurs="0" &gt;
          &lt;xsd:complexType&gt;
            &lt;xsd:all&gt;
              &lt;xsd:element ref="JPEG2000BitsPerComponentBox" /&gt;
              &lt;xsd:element ref="JPEG2000ColorSpecificationBox" /&gt;
              &lt;xsd:element ref="JPEG2000PaletteBox" minOccurs="0" /&gt;
              &lt;xsd:element ref="JPEG2000ComponentMappingBox" minOccurs="0" /&gt;
              &lt;xsd:element ref="JPEG2000ChannelDefinitionBox" minOccurs="0" /&gt;
              &lt;xsd:element ref="JPEG2000ResolutionBox" minOccurs="0" /&gt;
            &lt;/xsd:all&gt;
          &lt;/xsd:complexType&gt;
        &lt;/xsd:element&gt;
      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="jp2h" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 image header box --&gt;
  &lt;xsd:element name="JPEG2000HeaderBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element name="Width" type="xsd:unsignedInt" /&gt;
        &lt;xsd:element name="Height" type="xsd:unsignedInt" /&gt;
        &lt;xsd:element name="NumComponents" type="xsd:unsignedShort" /&gt;
        &lt;xsd:element name="BitDepth" type="xsd:byte" /&gt;
        &lt;xsd:element name="CompressionType" type="xsd:unsignedByte" /&gt;
        &lt;xsd:element name="UnknownColorspace" type="xsd:unsignedByte" /&gt;
        &lt;xsd:element name="IntellectualProperty"&gt;
          &lt;xsd:simpleType&gt;
            &lt;xsd:restriction base="xsd:unsignedByte"&gt;
              &lt;xsd:enumeration value="0" /&gt;
              &lt;xsd:enumeration value="1" /&gt;
            &lt;/xsd:restriction&gt;
          &lt;/xsd:simpleType&gt;
        &lt;/xsd:element&gt;

      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" fixed="22" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="ihdr" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 bits per component box --&gt;
  &lt;xsd:element name="JPEG2000BitsPerComponentBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element name="BitDepth" type="ByteList" /&gt;
      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="bpcc" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 color specification box --&gt;
  &lt;xsd:element name="JPEG2000ColorSpecificationBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;

        &lt;xsd:element name="Method"&gt;
          &lt;xsd:simpleType&gt;
            &lt;xsd:restriction base="xsd:unsignedByte"&gt;
              &lt;xsd:enumeration value="1" /&gt;
              &lt;xsd:enumeration value="2" /&gt;
            &lt;/xsd:restriction&gt;
          &lt;/xsd:simpleType&gt;
        &lt;/xsd:element&gt;

        &lt;xsd:element name="Precedence" type="xsd:byte" /&gt;
        &lt;xsd:element name="ApproximationAccuracy" type="xsd:byte" /&gt;
        &lt;xsd:element name="EnumeratedColorSpace" type="xsd:unsignedInt" /&gt;
        &lt;xsd:element name="ICCProfile" type="xsd:anyType" /&gt;

      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="colr" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 palette box --&gt;
  &lt;xsd:element name="JPEG2000PaletteBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;

        &lt;xsd:element name="NumberEntries"&gt;
          &lt;xsd:simpleType&gt;
            &lt;xsd:restriction base="xsd:unsignedShort"&gt;
              &lt;xsd:minInclusive value="1" /&gt;
              &lt;xsd:maxInclusive value="1024" /&gt;
            &lt;/xsd:restriction&gt;
          &lt;/xsd:simpleType&gt;
        &lt;/xsd:element&gt;

        &lt;xsd:element name="NumberColors"&gt;
          &lt;xsd:simpleType&gt;
            &lt;xsd:restriction base="xsd:unsignedShort"&gt;
              &lt;xsd:minInclusive value="1" /&gt;
              &lt;xsd:maxInclusive value="255" /&gt;
            &lt;/xsd:restriction&gt;
          &lt;/xsd:simpleType&gt;
        &lt;/xsd:element&gt;

        &lt;xsd:element name="BitDepth" type="ByteList" /&gt;

        &lt;xsd:element name="LUT"&gt;
          &lt;xsd:complexType&gt;
            &lt;xsd:sequence&gt;
              &lt;xsd:element name="LUTRow" maxOccurs="unbounded" type="ByteList" /&gt;
            &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
        &lt;/xsd:element&gt;

      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="pclr" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 component mapping box--&gt;
  &lt;xsd:element name="JPEG2000ComponentMappingBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence maxOccurs="unbounded"&gt;
        &lt;xsd:element name="Component" type="xsd:unsignedShort" /&gt;
        &lt;xsd:element name="ComponentType" type="xsd:unsignedByte" /&gt;
        &lt;xsd:element name="ComponentAssociation" type="xsd:unsignedByte" /&gt;
      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="cmap" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 channel definition box--&gt;
  &lt;xsd:element name="JPEG2000ChannelDefinitionBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element name="NumberOfDefinition" type="xsd:unsignedShort" /&gt;
        &lt;xsd:element name="Definitions"&gt;
          &lt;xsd:complexType&gt;
            &lt;xsd:sequence maxOccurs="unbounded"&gt;
              &lt;xsd:element name="ChannelNumber" type="xsd:unsignedShort" /&gt;
              &lt;xsd:element name="ChannelType"&gt;
                &lt;xsd:simpleType&gt;
                  &lt;xsd:restriction base="xsd:unsignedShort"&gt;
                    &lt;xsd:enumeration value="0" /&gt;
                    &lt;xsd:enumeration value="1" /&gt;
                    &lt;xsd:enumeration value="2" /&gt;
                    &lt;xsd:enumeration value="65535" /&gt;
                  &lt;/xsd:restriction&gt;
                &lt;/xsd:simpleType&gt;
              &lt;/xsd:element&gt;
              &lt;xsd:element name="ChannelAssociation" type="xsd:unsignedShort" /&gt;
            &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
        &lt;/xsd:element&gt;
      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="cdef" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 resolution box--&gt;
  &lt;xsd:element name="JPEG2000ResolutionBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element ref="JPEG2000CaptureResolutionBox" minOccurs="0" /&gt;
        &lt;xsd:element ref="JPEG2000DefaultDisplayResolutionBox" minOccurs="0" /&gt;
      &lt;/xsd:sequence&gt;

      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="res " /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 capture resolution box--&gt;
  &lt;xsd:element name="JPEG2000CaptureResolutionBox"&gt;
    &lt;xsd:complexType&gt;

      &lt;xsd:sequence&gt;
        &lt;xsd:element name="VerticalResolutionNumerator" type="xsd:unsignedShort" /&gt;
        &lt;xsd:element name="VerticalResolutionDenominator" type="xsd:unsignedShort" /&gt;
        &lt;xsd:element name="HorizontalResolutionNumerator" type="xsd:unsignedShort" /&gt;
        &lt;xsd:element name="HorizontalResolutionDenominator" type="xsd:unsignedShort" /&gt;
        &lt;xsd:element name="VerticalResolutionExponent" type="xsd:byte" /&gt;
        &lt;xsd:element name="HorizontalResolutionExponent" type="xsd:byte" /&gt;
      &lt;/xsd:sequence&gt;

      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" fixed ="18" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="resc" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 default display resolution box--&gt;
  &lt;xsd:element name="JPEG2000DefaultDisplayResolutionBox"&gt;
    &lt;xsd:complexType&gt;

      &lt;xsd:sequence&gt;
        &lt;xsd:element name="VerticalResolutionNumerator" type="xsd:unsignedShort" /&gt;
        &lt;xsd:element name="VerticalResolutionDenominator" type="xsd:unsignedShort" /&gt;
        &lt;xsd:element name="HorizontalResolutionNumerator" type="xsd:unsignedShort" /&gt;
        &lt;xsd:element name="HorizontalResolutionDenominator" type="xsd:unsignedShort" /&gt;
        &lt;xsd:element name="VerticalResolutionExponent" type="xsd:byte" /&gt;
        &lt;xsd:element name="HorizontalResolutionExponent" type="xsd:byte" /&gt;
      &lt;/xsd:sequence&gt;

      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" fixed ="18" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="resd" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 code stream box--&gt;
  &lt;xsd:element name="JPEG2000CodeStreamBox" &gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element name="CodeStream" type="xsd:anyType" /&gt;
      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="jp2c" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 intellectual property rights box--&gt;
  &lt;xsd:element name="JPEG2000IntellectualPropertyRightsBox" &gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;!-- The structure of this box is defined in Part 2 so keep it
                  general --&gt;
        &lt;xsd:element name="Content" type="xsd:anyType"  /&gt;
      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="jp2i" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 XML box--&gt;
  &lt;xsd:element name="JPEG2000XMLBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element name="Content" type="xsd:string" /&gt;
      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="xml " /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 UUID box--&gt;
  &lt;xsd:element name="JPEG2000UUIDBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element name="UUID"&gt;
          &lt;xsd:simpleType&gt;
            &lt;xsd:restriction base="ByteList"&gt;
              &lt;xsd:length value="16" /&gt;
            &lt;/xsd:restriction&gt;
          &lt;/xsd:simpleType&gt;
        &lt;/xsd:element&gt;
        &lt;xsd:element name="Data" type="xsd:anyType" /&gt;
      &lt;/xsd:sequence&gt;

      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="uuid" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 UUID info box--&gt;
  &lt;xsd:element name="JPEG2000UUIDInfoBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element ref="JPEG2000UUIDListBox" /&gt;
        &lt;xsd:element ref="JPEG2000DataEntryURLBox" /&gt;
      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="uinf" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 UUID list box--&gt;
  &lt;xsd:element name="JPEG2000UUIDListBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element name="NumberUUID" type="xsd:unsignedShort" /&gt;
        &lt;xsd:element name="UUID" maxOccurs="unbounded"&gt;
          &lt;xsd:simpleType&gt;
            &lt;xsd:restriction base="ByteList"&gt;
              &lt;xsd:length value="16" /&gt;
            &lt;/xsd:restriction&gt;
          &lt;/xsd:simpleType&gt;
        &lt;/xsd:element&gt;
      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="ulst" /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- JPEG 2000 Data Entry URL box--&gt;
  &lt;xsd:element name="JPEG2000DataEntryURLBox"&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element name="Version" type="xsd:unsignedByte" /&gt;
        &lt;xsd:element name="Flags"&gt;
          &lt;xsd:simpleType&gt;
            &lt;xsd:restriction base="ByteList"&gt;
              &lt;xsd:length value="3" /&gt;
            &lt;/xsd:restriction&gt;
          &lt;/xsd:simpleType&gt;
        &lt;/xsd:element&gt;
        &lt;xsd:element name="URL" type="xsd:anyURI" /&gt;
      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="Length" type="xsd:unsignedInt" use="required" /&gt;
      &lt;xsd:attribute name="Type" type="xsd:string" use="required" fixed="url " /&gt;
      &lt;xsd:attribute name="ExtraLength" type="LongNoLessThan16" use="optional" /&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

  &lt;!-- The basic types defined and used in JPEG 2000 schema --&gt;
  &lt;xsd:simpleType name="IntegerList"&gt;
    &lt;xsd:list itemType="xsd:unsignedInt" /&gt;
  &lt;/xsd:simpleType&gt;

  &lt;xsd:simpleType name="ByteList"&gt;
    &lt;xsd:list itemType="xsd:byte" /&gt;
  &lt;/xsd:simpleType&gt;

  &lt;xsd:simpleType name="LongNoLessThan16"&gt;
    &lt;xsd:restriction base="xsd:long"&gt;
      &lt;xsd:minInclusive value="16" /&gt;
    &lt;/xsd:restriction&gt;
  &lt;/xsd:simpleType&gt;

&lt;/xsd:schema&gt;
</pre>

<h4>Standard Image Metadata Derivation</h4>

The conversion between the native image metadata format and the standard
image metadata format is based on the following mapping:

<pre>
Standard Metadata Attribute        JP2 Box Element
---------------------------        ---------------
/Chroma
    /ColorSpaceType
	&#64;name			   if UnknownColorSpace in header box is 0
				   then if EnumeratedColorSpace in
					color specification box is 16 --> RGB
				        if EnumeratedColorSpace in
                                        color specification box is 17 -->GRAY
    /NumChannels
	&#64;value			   if palette box exists
					the component number in palette box 
				   else
					the component number in header box
    /Palette			   if palette box exits
	/PaletteEntry
	    &#64;index		   
	    &#64;red		   lut[index][0]
	    &#64;green		   lut[index][1]
	    &#64;blue		   lut[index][2]
	    &#64;alpha 		   lut[index][3] if the component number is 4

/Compression
    &#64;value			   "JPEG2000"

/Data
    /SampleFormat
	&#64;value			   if the palette box exists, -->"Index"
				   else if bit depth in header box or 
					bits per component box has the sign bit
					     --> "SignedIntegral"
					else --> "UnsignedIntegral"
    /BitsPerSample
	&#64;value			   derive from the bit depth of header box
				   or bits per component box
    /PlanarConfiguration
	&#64;value			   --> "TileInterleaved"

/Dimension
    /PixelAspectRatio
	&#64;value			   the ratio of the horizontal and vertical
				   resolution in the capture resolution box
    /HorizontalPhysicalPixelSpacing
	&#64;value			   derived from the horizontal resolution
				   (in pixel-per-meter) in the capture 
				   resolution box
    /VerticalPhysicalPixelSpacing 
        &#64;value                     derived from the vertical resolution         
                                   (in pixel-per-meter) in the capture i
				   resolution box
/Transparency
    /Alpha
	&#64;value			   --> "none" if no channel definition box or
					no alpha channel is defined in channel
					definition box
				   --> "nonpremultiplied" if no premultiplied
					channel is defined in the channel 
					definition box
				   --> "premultiplied" if any premultiplied
					channel(s) defined in the channel 
					definition box
/Text
    /TextEntry
	&#64;value			   The content of any XML box; each XML box
				   defines a TextEntry
</pre>

@since 1.0

</body>
